home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 2004-10-31 | 46.5 KB | 2,353 lines
Rem Project: ant academy Rem Created: 31/07/2004 14:39:37 Rem ***** Main Source File ***** rem SET UP STUFF randomize timer() sync on sync rate 200 set display mode 800,600,32 sync autocam off hide mouse disable escapekey ink 0,0 color backdrop 0 cheat=0 type levelinfotype terrain as byte obj as word pickup as byte appleno as word endtype type objinfotype obj as word x# y# z# endtype type antinfo oldx oldy oldz x# y# z# xmove# ymove# zmove# xmoveorig# ymoveorig# zmoveorig# yangle# endtype type appleinfo obj as word alive as byte timer# start as word min as word max as word x y z endtype type randomappleinfo alive as byte obj as word x as byte y as byte z as byte endtype type pickupparticleinfo alive fade# x# y# z# xvel# yvel# endtype type menustarinfo x# y# xvel# yvel# img endtype type messageletterinfo img x# y# endtype type highscoreinfo name$ score endtype dim ant(200) as antinfo dim objinfo(1000) as objinfotype dim level(100,10,100) as levelinfotype dim apple(10) as appleinfo dim randomapple(0) as randomappleinfo dim pickupparticle(20) as pickupparticleinfo dim menustar(60) as menustarinfo dim messageletter(1) as messageletterinfo dim highscore(10) as highscoreinfo dim keytype$(250) for x=0 to 200 keytype$(x)="" next x restore keytypedata read temp$ for x=2 to 11 keytype$(x)=mid$(temp$,x-1) next x read temp$ for x=16 to 25 keytype$(x)=mid$(temp$,x-15) next x read temp$ for x=30 to 38 keytype$(x)=mid$(temp$,x-29) next x read temp$ for x=44 to 50 keytype$(x)=mid$(temp$,x-43) next x keytype$(57)=" " keytypedata: data "1234567890" data "qwertyuiop" data "asdfghjkl" data "zxcvbnm" for x=1 to 60 menustar(x).x#=rnd(800) menustar(x).y#=x*10 menustar(x).img=8+rnd(2) menustar(x).xvel#=(((rnd(30)+5)/10))-1.5 menustar(x).yvel#=(((rnd(10)+5)/10))+1 next x levelno=1 left=203 right=205 up=200 down=208 obno=501 global particleindex particleindex=1 global quit quit=0 rem LOAD INTRO MEDIA load image "gfx\cover.png",3 load image "gfx\cover2.png",4 make object cube 1,1 hide object 1 load image "gfx\fb1.png",1,1 load image "gfx\fb2.png",2,1 sprite 1,400,400,1 offset sprite 1,sprite width(1)/2,sprite height(1)/2 sprite 3,400,350,3 set sprite priority 1,3 offset sprite 3,sprite width(3)/2,0 set sprite priority 3,4 rem INTRO for x=500 to 300 step -1 sprite 1,400,x,1 offset sprite 1,sprite width(1)/2,sprite height(1)/2 sync wait 4 next x delete sprite 3 sprite 2,400,300,2 offset sprite 2,sprite width(2)/2,sprite height(2)/2 set sprite priority 2,1 sprite 3,0,300,4 offset sprite 3,0,50 set sprite priority 3,2 for x= -100 to 800 step 2 sprite 3,x,300,4 sync next x opscreenres=2 opantpoly=4 opmusic=1 opsoundfx=1 if file exist("settings.dat")=1 open to read 1,"settings.dat" read file 1,opscreenres read file 1,opantpoly read file 1,opmusic read file 1,opsoundfx else open to write 1,"settings.dat" write file 1,opscreenres write file 1,opantpoly write file 1,opmusic write file 1,opsoundfx endif close file 1 open to read 1,"leveldata\level10.dat" read string 1,temp$ highscore(1).name$=temp$ read file 1,temp highscore(1).score=temp close file 1 wait key for x=255 to 0 step -1 set sprite alpha 1,x set sprite alpha 2,x sync next x rem DESTROY INTRO MEDIA for x=1 to 3 delete sprite x delete image x next x delete image 4 delete object 1 color backdrop rgb (255,255,255) backdrop off draw to back gosub loadmenumedia menu: dim message$(5) message$(1)="ants need to learn how to make a line from food source to nest so they come to ant academy where you teach them to march from a to b easy eh?" message$(2)=" okay scoring goes like this, every apple you eat adds another ant to line, you score 1x ants in line for green apple, 2x for red apple and 4x for gold apple." message$(3)=" red apples are placed in tricky places and gold are placed in dangerous places. as soon as you got enough ants either make a line from a to b or try to build your score," message$(4)=" remember the more ants in the line then the more you score. at 1000 points you get an extra life, at 2500 you get another and then you get another at every 5000 points." message$(5)=" okay congratulations and hushed awe at our leading scorer "+highscore(1).name$+" with a high score of "+str$(highscore(1).score)+"." mesno=1 temp=0 for x=1 to 5 temp=temp+len(message$(x)) next x z=0 templen=1 for x=1 to temp if templen>len(message$(mesno)) inc mesno templen=1 endif if mid$(message$(mesno),templen)=" " then inc z,1 inc templen next x z=temp-z messagelength=z undim messageletter(0) dim messageletter(z) as messageletterinfo messageindex=1 messagex=810 mesno=1 templen=1 for x=1 to temp if templen>len(message$(mesno)) inc mesno templen=1 endif temp$=mid$(message$(mesno),templen) if temp$<>" " messageletter(messageindex).img=asc(temp$) messageletter(messageindex).x#=messagex `if temp$="." or temp$="," `mlypos=550 `else `mlypos=530 `endif `messageletter(messageindex).yorig#=mlypos `messageletter(messageindex).y#=mlypos sprite 73,-50,-50,messageletter(messageindex).img inc messagex,sprite width(73)+3 inc messageindex,1 else inc messagex,25 endif inc templen next x messagewidth=messagex sprite 68,400,300,11 sprite 69,400,370,12 sprite 70,400,440,13 for x=68 to 70 offset sprite x,sprite width(x)/2,sprite height(x)/2 set sprite priority x,2 hide sprite x next x rem menu sprite 1,400,300,1 offset sprite 1,400,300 set sprite priority 1,10 sprite 2,0,0,2 sprite 3,400,300,3 sprite 4,400,370,4 sprite 5,400,440,5 sprite 6,400,80,6 sprite 7,400,200,7 for x=1 to 60 sprite (x+7),menustar(x).x#,menustar(x).y#,menustar(x).img next x for x=3 to 7 offset sprite x,sprite width(x)/2,sprite height(x)/2 set sprite priority x,3 next x for x=8 to 67 offset sprite x,sprite width(x)/2,sprite height(x)/2 set sprite priority x,1 next x scale=100 alph=255 loop music 1 cheatkey=25 sprite 1000,400,300,200 offset sprite 1000,sprite width(1000)/2,sprite height(1000)/2 hide sprite 1000 set sprite priority 1000,10 sprite 1001,400,300,201 offset sprite 1001,sprite width(1001)/2,sprite height(1001)/2 hide sprite 1001 set sprite priority 1001,10 repeat option=0 sprite 71,mousex(),mousey(),14 set sprite priority 71,5 for x=1 to 3 if mousex()>(sprite x(x+2)-(sprite width(x+2)/2)) and mousex()<(sprite x(x+2)+(sprite width(x+2)/2)) and mousey()>(sprite y(x+2)-(sprite height(x+2)/2)) and mousey()<(sprite y(x+2)+(sprite height(x+2)/2)) option=x exit endif next x hide sprite 68 hide sprite 69 hide sprite 70 if option show sprite option+67 endif for x=1 to 60 inc menustar(x).x#,menustar(x).xvel# inc menustar(x).y#,menustar(x).yvel# if menustar(x).y#>630 menustar(x).y#=0-rnd(100) menustar(x).x#=rnd(1600)-400 endif sprite x+7,menustar(x).x#,menustar(x).y#,menustar(x).img next x scale sprite 1,scale inc scale,10 if scale>800 and alph=>0 set sprite alpha 1,alph dec alph,1 endif sync until scale>1000 and alph<0 delete sprite 1 start=0 repeat if keystate(25) then cheatkey=47 if keystate(cheatkey) if cheatkey=47 cheatkey=33 else if cheatkey=33 cheatkey=46 else if cheatkey=46 cheatkey=25 cheatalph=255 cheatalphtimer=timer()+200 if cheat=1 cheat=0 hide sprite 1000 show sprite 1001 else cheat=1 hide sprite 1001 show sprite 1000 endif endif endif endif endif if sprite visible(1000) set sprite alpha 1000,cheatalph else if sprite visible(1001) set sprite alpha 1001,cheatalph endif endif if cheatalph>0 and timer()>cheatalphtimer dec cheatalph,5 cheatalphtimer=timer()+50 if cheatalph<=0 cheatalph=0 hide sprite 1000 hide sprite 1001 endif endif option=0 sprite 71,mousex(),mousey(),14 set sprite priority 71,6 if sprite exist(72)=0 for x=1 to 3 if mousex()>(sprite x(x+2)-(sprite width(x+2)/2)) and mousex()<(sprite x(x+2)+(sprite width(x+2)/2)) and mousey()>(sprite y(x+2)-(sprite height(x+2)/2)) and mousey()<(sprite y(x+2)+(sprite height(x+2)/2)) option=x exit endif next x hide sprite 68 hide sprite 69 hide sprite 70 if option show sprite option+67 endif if mouseclick()=1 mouseclicked=1 select option case 1 start=1 endcase case 2 sprite 72,400,300,15 sprite 73,400,110,16 sprite 74,400,210,17 sprite 75,400,310,18 sprite 76,400,410,19 sprite 77,400,150,opscreenres+19 sprite 78,400,250,opantpoly+22 sprite 79,400,350,opmusic+26 sprite 80,400,450,opsoundfx+26 offset sprite 72,sprite width(72)/2,sprite height(72)/2 set sprite priority 72,4 hide sprite 69 for x=73 to 80 offset sprite x,sprite width(x)/2,sprite height(x)/2 set sprite priority x,5 next x endcase case 3 end endcase endselect endif else opselect=0 for x=1 to 8 if mousex()>(sprite x(x+72)-(sprite width(x+72)/2)) and mousex()<(sprite x(x+72)+(sprite width(x+72)/2)) and mousey()>(sprite y(x+72)-(sprite height(x+72)/2)) and mousey()<(sprite y(x+72)+(sprite height(x+72)/2)) opselect=x exit endif next x sprite 77,400,150,opscreenres+19 sprite 78,400,250,opantpoly+22 sprite 79,400,350,opmusic+26 sprite 80,400,450,opsoundfx+26 sprite 81,400,150,opscreenres+28 sprite 82,399,109,32 if opantpoly=2 sprite 83,400,250,34 else if opantpoly=1 sprite 83,399,250,33 else sprite 83,399,249,opantpoly+32 endif endif sprite 84,400,209,37 sprite 85,399,350,opmusic+37 sprite 86,400,309,40 sprite 87,399,450,opsoundfx+37 sprite 88,399,409,41 for x=81 to 88 hide sprite x next x for x=77 to 88 offset sprite x,sprite width(x)/2,sprite height(x)/2 set sprite priority x,5 next x select opselect case 1 show sprite 82 endcase case 2 show sprite 84 endcase case 3 show sprite 86 endcase case 4 show sprite 88 endcase case 5 show sprite 81 endcase case 6 show sprite 83 endcase case 7 show sprite 85 endcase case 8 show sprite 87 endcase endselect if mouseclick()<>1 then mouseclicked=0 if mouseclick()=1 and mouseclicked=0 mouseclicked=1 if opselect=1 or opselect=5 inc opscreenres if opscreenres>3 then opscreenres=1 else if opselect=2 or opselect=6 inc opantpoly if opantpoly>4 then opantpoly=1 else if opselect=3 or opselect=7 if opmusic=1 opmusic=2 else opmusic=1 endif else if opselect=4 or opselect=8 if opsoundfx=1 opsoundfx=2 else opsoundfx=1 endif endif endif endif endif endif if mousex()<(sprite x(72)-sprite width(72)/2) or mousex()>(sprite x(72)+sprite width(72)/2) or mousey()<(sprite y(72)-sprite height(72)/2) or mousey()>(sprite y(72)+sprite height(72)/2) for x=72 to 88 delete sprite x next x endif endif for x=1 to 60 inc menustar(x).x#,menustar(x).xvel# inc menustar(x).y#,menustar(x).yvel# if menustar(x).y#>630 menustar(x).y#=0-rnd(100) menustar(x).x#=rnd(1600)-400 endif sprite x+7,menustar(x).x#,menustar(x).y#,menustar(x).img next x messagesprite=89 for x=1 to messagelength if sprite exist(x+88) then delete sprite x+88 if messageletter(x).x#<800 if messageletter(x).img=44 or messageletter(x).img=46 sprite messagesprite,messageletter(x).x#,messageletter(x).y#+20,messageletter(x).img else sprite messagesprite,messageletter(x).x#,messageletter(x).y#,messageletter(x).img endif set sprite priority messagesprite,4 inc messagesprite,1 endif next x for x=messagelength to 1 step -1 dec messageletter(x).x#,1 if messageletter(x).x#<-50 messageletter(x).x#=messagewidth endif if x=1 messageletter(x).y#=530+(sin(ang#)*20) ang#=wrapvalue(ang#+3) else messageletter(x).y#=messageletter(x-1).y# endif next x sync until start y=800 make object plain 101,250,250 texture object 101,42 set object texture 101,2,0 set object transparency 101,4 set object light 101,0 position object 101,-250,0,200 lock object on 101 make object plain 102,250,250 zrotate object 102,180 texture object 102,42 set object texture 102,2,0 set object transparency 102,4 set object light 102,0 position object 102,200,0,200 lock object on 102 y=250 for z=-250 to -70 step 3 position object 101,z,0,200 position object 102,y,0,200 dec y,3 for x=1 to 60 inc menustar(x).x#,menustar(x).xvel# inc menustar(x).y#,menustar(x).yvel# if menustar(x).y#>630 menustar(x).y#=0-rnd(100) menustar(x).x#=rnd(1600)-400 endif sprite x+7,menustar(x).x#,menustar(x).y#,menustar(x).img next x sync next z for x=1 to 71 if x>1 then delete sprite x if x<43 then delete image x next x delete image 46 delete image 44 delete image 63 delete image 200 delete image 201 delete sprite 1000 delete sprite 1001 delete object 101 delete object 102 for x=0 to 9 delete image 48+x next x for x=1 to 26 delete image x+96 next x for x=1 to messagelength if sprite exist(x+88) then delete sprite x+88 next x rem MAIN GAME ants=0 score=0 extralife=1000 if cheat=1 lives=99 else lives=5 endif levelno=1 bgno=1 bgmus=1 complete=0 applesalive=0 if opscreenres=1 if check display mode(640,480,16) then set display mode 640,480,16 else if opscreenres=3 if check display mode(1024,768,32) then set display mode 1024,768,32 endif endif color backdrop rgb(255,255,255) load image "gfx\wipe3.png",42,1 make object plain 101,250,250 texture object 101,42 set object texture 101,2,0 set object transparency 101,1 set object light 101,0 position object 101,-70,0,200 lock object on 101 make object plain 102,250,250 zrotate object 102,180 texture object 102,42 set object texture 102,2,0 set object transparency 102,1 set object light 102,0 position object 102,70,0,200 lock object on 102 gosub loadgamemedia gosub loadlevelmedia gosub positioncamera wipeoff() fps=200 makenewant=0 alph1=0 directionpicked=0 `gosub positioncamera loop object 1000 frames=39 seconds#=timer()-1 fps=200 do if music playing(1)=0 then loop music 1 inc frames,1 if timer()>seconds# seconds#=timer()+200 fps=frames*5 if frames>maxframes then maxframes=frames frames=0 endif gosub keyboardinput gosub positionants gosub positioncamera gosub movepickupparticles spin#=75.0/fps position object 2001,ant(0).x#-6,ant(0).y#+8,ant(0).z#-1 xrotate object 2001,object angle x(2001)+spin# yrotate object 2001,object angle y(2001)+spin# zrotate object 2001,object angle z(2001)+spin# position object 2002,ant(0).x#+6,ant(0).y#+8,ant(0).z#-1 xrotate object 2002,object angle x(2002)-spin# yrotate object 2002,object angle y(2002)-spin# zrotate object 2002,object angle z(2002)-spin# if keystate(1) seconds#=pausegame(seconds#-timer(),opmusic,ants) if quit delete music 1 for x=1 to 4 delete sound x next x for x=1000 to 1000+ants delete object x next x for x=400 to 500+objs if object exist(x) then delete object x next x for x=1 to 100 if sprite exist(x) then delete sprite x if image exist(x) then delete image x next x set display mode 800,600,32 gosub loadmenumedia goto menu endif endif sync loop rem *** SUB ROUTINES *** loadgamemedia: load sound "sound\fall.wav",1 load sound "sound\crash.wav",2 load sound "sound\bite.wav",3 load sound "sound\gameover.wav",4 set sound volume 3,85 if opsoundfx=2 for x=1 to 3 set sound volume x,0 next x endif if opantpoly=1 make object box 1000,0.5,1.5,0.5 color object 1000,rgb(255,0,0) yoffset#=1 else if opantpoly=2 make object box 1000,0.5,1.5,0.5 color object 1000,rgb(255,0,0) yoffset#=1 else if opantpoly=3 load object "gfx\antmp.dbo",1000 color object 1000,rgb(255,0,0) yoffset#=1 else load object "gfx\anthp.dbo",1000 yoffset#=1.5 yrotate object 1000,180 fix object pivot 1000 endif endif endif set object specular 1000,rgb(255,255,255) set object specular power 1000,25 position light 0,-50,150,-50 point light 0,50,5,50 make object plain 421,1,1 make object plain 422,1,1 load image "gfx\star1.png",31 load image "gfx\star2.png",32 texture object 421,31 texture object 422,32 set object transparency 421,1 set object transparency 422,1 for count=423 to 440 step 2 instance object count,421 hide object count next count for count=424 to 440 step 2 instance object count,422 hide object count next count load image "gfx\pbg.png",33,1 load image "gfx\resume.png",35,1 load image "gfx\quit.png",36,1 return loadmenumedia: load music "sound\menu1.mp3",1 load image "gfx\wipe1.png",1,1 load image "gfx\menu\menu.png",2,1 load image "gfx\menu\start.png",3,1 load image "gfx\menu\options.png",4,1 load image "gfx\menu\exit.png",5,1 load image "gfx\menu\ant.png",6,1 load image "gfx\menu\acadamy.png",7,1 load image "gfx\menu\starb.png",8,1 load image "gfx\menu\starg.png",9,1 load image "gfx\menu\stary.png",10,1 load image "gfx\menu\startlit.png",11,1 load image "gfx\menu\optionslit.png",12,1 load image "gfx\menu\exitlit.png",13,1 load image "gfx\menu\cursor.png",14,1 load image "gfx\menu\optionbg.png",15,1 load image "gfx\menu\opsr.png",16,1 load image "gfx\menu\opam.png",17,1 load image "gfx\menu\opm.png",18,1 load image "gfx\menu\opsfx.png",19,1 load image "gfx\menu\op640x480.png",20,1 load image "gfx\menu\op800x600.png",21,1 load image "gfx\menu\op1024x768.png",22,1 load image "gfx\menu\opbox.png",23,1 load image "gfx\menu\oplowpoly.png",24,1 load image "gfx\menu\opmediumpoly.png",25,1 load image "gfx\menu\ophighpoly.png",26,1 load image "gfx\menu\opon.png",27,1 load image "gfx\menu\opoff.png",28,1 load image "gfx\menu\op640x480lit.png",29,1 load image "gfx\menu\op800x600lit.png",30,1 load image "gfx\menu\op1024x768lit.png",31,1 load image "gfx\menu\opsrlit.png",32,1 load image "gfx\menu\opboxlit.png",33,1 load image "gfx\menu\oplowpolylit.png",34,1 load image "gfx\menu\opmediumpolylit.png",35,1 load image "gfx\menu\ophipolylit.png",36,1 load image "gfx\menu\opamlit.png",37,1 load image "gfx\menu\oponlit.png",38,1 load image "gfx\menu\opofflit.png",39,1 load image "gfx\menu\opmlit.png",40,1 load image "gfx\menu\opsfxlit.png",41,1 load image "gfx\wipe3.png",42,1 for x=0 to 9 load image "gfx\menu\font1\"+str$(x)+".png",48+x,1 next x x$="abcdefghijklmnopqrstuvwxyz" for x=1 to 26 load image "gfx\menu\font1\"+mid$(x$,x)+".png",96+x,1 next x load image "gfx\menu\font1\fs.png",46,1 load image "gfx\menu\font1\com.png",44,1 load image "gfx\menu\font1\qm.png",63,1 load image "gfx\menu\cheatson.png",200,1 load image "gfx\menu\cheatsoff.png",201,1 return loadlevelmedia: if image exist(1) then delete image 1 load image "leveldata\bg"+str$(bgno)+".png",1,1 sprite 100,0,0,1 size sprite 100,screen width(),screen height() if music exist(1) then delete music 1 load music "sound\midi\bg"+str$(bgmus)+".mid",1 set music volume 1,50 if opmusic=2 set music volume 1,0 endif load object "gfx\10x10bw.dbo",1 load object "gfx\5x5b.dbo",2 load object "gfx\5x5w.dbo",3 make object box 4,1,1,1 color object 4,0 set object specular 4,rgb(255,255,255) set object specular power 4,4 make object box 5,5,1,1 color object 5,0 set object specular 5,rgb(255,255,255) set object specular power 5,4 make object box 6,10,1,1 color object 6,0 set object specular 6,rgb(255,255,255) set object specular power 6,4 make object box 7,1,1,5 color object 7,0 set object specular 7,rgb(255,255,255) set object specular power 7,4 make object box 8,1,1,10 color object 8,0 set object specular 8,rgb(255,255,255) set object specular power 8,4 load object "gfx\applegreen.dbo",9 load object "gfx\slant.dbo",10 load object "gfx\slant2.dbo",11 load object "gfx\slant3.dbo",12 load object "gfx\slant4.dbo",13 load object "gfx\a.dbo",14 load object "gfx\b.dbo",15 load object "gfx\a2.dbo",16 load object "gfx\b2.dbo",17 load object "gfx\slantb.dbo",18 load object "gfx\slantb2.dbo",19 load object "gfx\slantb3.dbo",20 load object "gfx\slantb4.dbo",21 load object "gfx\applered.dbo",22 load object "gfx\applegold.dbo",23 for count=1 to 21 set object ambient count,0 next count ant(0).x#=50 ant(0).y#=5 ant(0).z#=50 xdir=0 ydir=0 zdir=-1 destination=1 levname$="level"+str$(levelno) appleno=1 randappleindex=0 if file exist("leveldata\"+levname$+".dat") open to read 1,"leveldata\"+levname$+".dat" read word 1,objs read word 1,apples read word 1,randomapples read word 1,temp ant(0).x#=temp read word 1,temp ant(0).y#=temp read word 1,temp ant(0).z#=temp for count=1 to randomapples clone object count+400,9 hide object count+400 next count for count=1 to objs read word 1,temp objinfo(count).obj=temp read float 1,temp# objinfo(count).x#=temp# read float 1,temp# objinfo(count).y#=temp# read float 1,temp# objinfo(count).z#=temp# next count for count=0 to 100 for count2=0 to 10 for count3=0 to 100 read byte 1,temp level(count,count2,count3).terrain=temp read word 1,temp level(count,count2,count3).obj=temp read byte 1,temp level(count,count2,count3).pickup=temp if temp=1 or temp=3 or temp=4 apple(appleno).obj=level(count,count2,count3).obj apple(appleno).alive=0 level(count,count2,count3).appleno=appleno apple(appleno).x=count apple(appleno).y=count2 apple(appleno).z=count3 inc appleno else if temp=2 if levelno<>5 or count2=5 inc randappleindex,1 array insert at bottom randomapple(0) randomapple(randappleindex).alive=0 randomapple(randappleindex).obj=0 randomapple(randappleindex).x=count randomapple(randappleindex).y=count2 randomapple(randappleindex).z=count3 endif endif endif next count3 next count2 next count for count=1 to apples read word 1,temp apple(count).start=temp apple(count).timer#=timer()+(temp*1000) read word 1,temp apple(count).min=temp read word 1,temp apple(count).max=temp next count close file 1 obno=501 for count=1 to objs clone object obno,objinfo(count).obj position object obno,objinfo(count).x#,objinfo(count).y#,objinfo(count).z# if objinfo(count).obj=9 or objinfo(count).obj=22 or objinfo(count).obj=23 hide object obno endif inc obno next count for count=1 to 23 delete object count next count endif load image "gfx\font1\ants.png",2,1 sprite 1,screen width()*0.01,10,2 load image "gfx\font1\lives.png",3,1 sprite 2,0,10,3 sprite 2,screen width()-sprite width(2)-(screen width()*0.01),10,3 load image "gfx\font1\score.png",4,1 sprite 3,screen width()/2,10,4 offset sprite 3,sprite width(3)/2,0 load image "gfx\font1\0.png",5,1 load image "gfx\font1\1.png",6,1 load image "gfx\font1\2.png",7,1 load image "gfx\font1\3.png",8,1 load image "gfx\font1\4.png",9,1 load image "gfx\font1\5.png",10,1 load image "gfx\font1\6.png",11,1 load image "gfx\font1\7.png",12,1 load image "gfx\font1\8.png",13,1 load image "gfx\font1\9.png",14,1 printscore(score) printants(ants) printlives(lives) load image "gfx\a3.png",15,1 load image "gfx\b3.png",16,1 make object box 2001,1.5,1.5,1.5 make object box 2002,1.5,1.5,1.5 texture object 2001,15 texture object 2002,16 set object transparency 2001,1 set object transparency 2002 ,2 hide object 2001 hide object 2002 load image "gfx\font1\l.png",17,1 load image "gfx\font1\e.png",18,1 load image "gfx\font1\v.png",19,1 load image "gfx\font1\c.png",20,1 load image "gfx\font1\o.png",21,1 load image "gfx\font1\m.png",22,1 load image "gfx\font1\p.png",23,1 load image "gfx\font1\t.png",24,1 load image "gfx\crash.png",25,1 load image "gfx\argh.png",26,1 load image "gfx\gameover.png",27,1 return keyboardinput: if scancode()=0 keypress=0 endif if keystate(left)=0 then leftpress=0 if keystate(right)=0 then rightpress=0 if keystate(up)=0 then uppress=0 if keystate(down)=0 then downpress=0 if keystate(left) and ant(0).xmove#=0 and leftpress=0 leftpress=1 xdir=-1 zdir=0 directionpicked=1 else if keystate(right) and ant(0).xmove#=0 and rightpress=0 rightpress=1 xdir=1 zdir=0 directionpicked=1 else if keystate(up) and ant(0).zmove#=0 and uppress=0 uppress=1 zdir=1 xdir=0 directionpicked=1 else if keystate(down) and ant(0).zmove#=0 and downpress=0 downpress=1 zdir=-1 xdir=0 directionpicked=1 endif endif endif endif if keystate(30) and keypress=0 and cheat=1 and ants<49 makenewant=1 keypress=1 endif return positionants: if destination tempx=ant(0).x# tempy=ant(0).y# tempz=ant(0).z# for count=1 to randappleindex if randomapple(count).alive=1 if randomapple(count).y=tempy and randomapple(count).x=tempx and randomapple(count).z=tempz makenewant=1 score=score+1+ants printscore(score) if score=>extralife and lives<99 inc lives,1 printlives(lives) if extralife=1000 extralife=2500 else if extralife=2500 extralife=5000 else extralife=extralife+5000 endif endif endif makepickupparticles(tempx,tempy,tempz) dec applesalive,1 hide object randomapple(count).obj randomapple(count).alive=0 exit endif endif next count temp=level(tempx,tempy,tempz).appleno if (level(tempx,tempy,tempz).pickup=1 or level(tempx,tempy,tempz).pickup=3 or level(tempx,tempy,tempz).pickup=4) and (apple(temp).alive=1) makepickupparticles(tempx,tempy,tempz) makenewant=1 select level(tempx,tempy,tempz).pickup case 1 score=score+1+ants endcase case 3 score=score+((1+ants)*2) endcase case 4 score=score+((1+ants)*4) endcase endselect printscore(score) if score=>extralife and lives<99 inc lives,1 printlives(lives) if extralife=1000 extralife=2500 else if extralife=2500 extralife=5000 else extralife=extralife+5000 endif endif endif apple(temp).alive=0 apple(temp).timer#=(apple(temp).min*1000)+rnd(((apple(temp).max-apple(temp).min)*1000))+timer() hide object apple(temp).obj endif if makenewant inc ants printants(ants) if ants<=200 clone object 1000+ants,1000 if opantpoly=4 yrotate object 1000+ants,180 fix object pivot 1000+ants endif loop object 1000+ants endif makenewant=0 endif if ants>0 for count=ants to 1 step -1 ant(count).x#=ant(count-1).oldx ant(count).y#=ant(count-1).oldy ant(count).z#=ant(count-1).oldz ant(count).oldx=ant(count-1).oldx ant(count).oldy=ant(count-1).oldy ant(count).oldz=ant(count-1).oldz ant(count).xmoveorig#=ant(count-1).xmoveorig# ant(count).ymoveorig#=ant(count-1).ymoveorig# ant(count).zmoveorig#=ant(count-1).zmoveorig# ant(count).yangle#=ant(count-1).yangle# next count endif ydir=0 tempx=ant(0).x# tempy=ant(0).y# tempz=ant(0).z# if tempy<0 gosub argh else collide=0 if ants>0 for count=1 to ants tempx2=ant(count).x# tempy2=ant(count).y# tempz2=ant(count).z# if tempx=tempx2 and tempy=tempy2 and tempz=tempz2 collide=1 exit endif next count endif if collide gosub crash else if level(tempx,tempy,tempz).terrain=0 tempxdir=xdir tempzdir=zdir xdir=0 zdir=0 ydir=-1 else if level(tempx,tempy,tempz).terrain=2 gosub crash else if level(tempx,tempy,tempz).terrain=3 ydir=1 else if level(tempx,tempy,tempz).terrain=4 ydir=-1 else if level(tempx,tempy,tempz).terrain=5 show object 2001 else if level(tempx,tempy,tempz).terrain=6 show object 2002 endif endif endif endif endif endif endif endif for count=1 to apples if timer()>apple(count).timer# and apple(count).alive=0 temp=0 for count2=1 to ants if ant(count2).oldx=apple(count).x and ant(count2).oldy=apple(count).y and ant(count2).oldz=apple(count).z temp=1 exit endif next count2 if temp=0 apple(count).alive=1 show object apple(count).obj endif endif next count if timer()>randappletimer# and applesalive<randomapples temp=rnd(randappleindex-1)+1 for count= 401 to 400+randomapples if object visible(count)=0 tempobj=count endif next count if randomapple(temp).alive=0 checkhit=0 if ants>0 for count2=1 to ants if ant(count2).oldx=randomapple(temp).x and ant(count2).oldy=randomapple(temp).y and ant(count2).oldz=randomapple(temp).z checkhit=1=1 exit endif next count2 endif if checkhit=0 randomapple(temp).obj=tempobj show object tempobj position object tempobj,randomapple(temp).x+0.5,randomapple(temp).y+0.5,randomapple(temp).z-0.5 randomapple(temp).alive=1 inc applesalive,1 temp=rnd(3000)+2000 randappletimer#=timer()+temp endif endif endif if object visible(2001) temp=0 for count=0 to ants tempx=ant(count).x# tempy=ant(count).y# tempz=ant(count).z# if level(tempx,tempy,tempz).terrain=5 temp=1 exit endif next count if temp=0 then hide object 2001 endif if object visible(2002) temp=0 for count=0 to ants tempx=ant(count).x# tempy=ant(count).y# tempz=ant(count).z# if level(tempx,tempy,tempz).terrain=6 temp=1 exit endif next count if temp=0 then hide object 2002 endif if object visible(2001) and object visible(2002) lcvol=50 lcx=-130 lctimer#=timer() for count=1 to 13 if count=1 or count=5 or count=10 lcimg=17 else if count=2 or count=4 or count=11 or count=13 lcimg=18 else if count=3 lcimg=19 else if count=12 lcimg=24 else lcimg=count+14 endif endif endif endif make object plain count+102,25,25 texture object count+102,lcimg set object transparency count+102,4 set object light count+102,0 position object count+102,lcx,0,210 lock object on count+102 ` sync if count=5 inc lcx,40 else inc lcx,20 endif for count2=0 to ants stop object 1000+count2 next count2 repeat if opmusic=1 set music volume 1,lcvol if lcvol>0 then dec lcvol endif sync until timer()>lctimer# lctimer#=timer()+50 next count set music volume 1,0 wait key wipeon() inc bgno if bgno>5 then bgno=1 inc bgmus if bgmus>9 then bgmus=1 for count=421 to 440 if object exist(count) then hide object count next count for count=103 to 115 delete object count next count `delete object 103 for count=1 to ants delete object count+1000 next count for count=1 to 30 if sprite exist(count) then delete sprite count next count for count=501 to objs+500 delete object count next count for count=2 to 25 delete image count next count delete object 2001 delete object 2002 for count=1 to randomapples delete object count+400 next count inc levelno,1 if levelno>8 then levelno=1 ants=0 complete=0 applesalive=0 undim randomapple(0) dim randomapple(0) as randomappleinfo gosub loadlevelmedia frames=maxframes seconds#=0 makenewant=0 destination=1 maxframes=0 gosub positioncamera hide object 1000 wipeoff() show object 1000 loop object 1000 return endif headxdest=ant(0).x#+xdir ant(0).xmoveorig#=xdir*7 headydest=ant(0).y#+ydir ant(0).ymoveorig#=ydir*7 headzdest=ant(0).z#+zdir ant(0).zmoveorig#=zdir*7 destination=0 ant(0).oldx=ant(0).x# ant(0).oldy=ant(0).y# ant(0).oldz=ant(0).z# for count=0 to ants ant(count).xmove#=ant(count).xmoveorig#/fps ant(count).ymove#=ant(count).ymoveorig#/fps ant(count).zmove#=ant(count).zmoveorig#/fps next count if xdir<0 ant(0).yangle#=90 else if xdir>0 ant(0).yangle#=270 else if zdir<0 ant(0).yangle#=0 else if zdir>0 ant(0).yangle#=180 endif endif endif endif endif speed=3800/fps if speed>100 then speed=100 for count=0 to ants ant(count).x#=ant(count).x#+ant(count).xmove# ant(count).y#=ant(count).y#+ant(count).ymove# ant(count).z#=ant(count).z#+ant(count).zmove# set object speed count+1000,speed next count temp=0 if ant(0).xmove#>0 if ant(0).x#=>headxdest temp=1 ant(0).x#=headxdest destination=1 endif else if ant(0).xmove#<0 if ant(0).x#=<headxdest temp=1 ant(0).x#=headxdest destination=1 endif else if ant(0).zmove#>0 if ant(0).z#=>headzdest temp=1 ant(0).z#=headzdest destination=1 endif else if ant(0).zmove#<0 if ant(0).z#=<headzdest temp=1 ant(0).z#=headzdest destination=1 endif else if ant(0).ymove#<0 if ant(0).y#=<headydest temp=1 ant(0).y#=headydest zdir=tempzdir xdir=tempxdir destination=1 endif endif endif endif endif endif if temp ant(0).y#=headydest ` if ants>1 for count=ants to 1 step -1 ant(count).x#=ant(count-1).oldx ant(count).y#=ant(count-1).oldy ant(count).z#=ant(count-1).oldz next count endif for count=0 to ants position object 1000+count,ant(count).x#+0.5,ant(count).y#+yoffset#,ant(count).z#-0.5 yrotate object 1000+count,ant(count).yangle# next count return positioncamera: position camera ant(0).x#,ant(0).y#+10,ant(0).z#-15 point camera ant(0).x#,ant(0).y#,ant(0).z# return crash: stop music 1 play sound 2 for count=1 to ants stop object count+1000 next count make object plain 99,250,250 position object 99,0,0,210 texture object 99,25 set object light 99,0 set object transparency 99,4 lock object on 99 sync wait key if lives=1 delete object 99 make object plain 99,250,250 position object 99,0,0,210 texture object 99,27 set object light 99,0 set object transparency 99,4 lock object on 99 play sound 4 sync wait key wipeon() delete music 1 for x=1 to 4 delete sound x next x for x=1000 to 1000+ants delete object x next x for x=400 to 500+objs if object exist(x) then delete object x next x for x=1 to 100 if sprite exist(x) then delete sprite x if image exist(x) then delete image x next x set display mode 800,600,32 gosub highscoretable goto menu endif wipeon() for count=1 to 20 if object exist(count+420) then hide object count+420 next count delete object 99 for count=1 to ants delete object count+1000 next count for count=501 to objs+500 delete object count next count for count=2 to 25 delete image count next count delete object 2001 delete object 2002 for count=1 to randomapples delete object count+400 next count dec lives,1 ants=0 applesalive=0 undim randomapple(0) dim randomapple(0) as randomappleinfo gosub loadlevelmedia makenewant=0 destination=1 for count=4 to 17 if sprite exist(count) then delete sprite count next count printscore(score) printants(ants) printlives(lives) hide object 1000 gosub positioncamera wipeoff() show object 1000 seconds#=timer()-1 frames=39 return argh: stop music 1 play sound 1 yvel#=0 make object plain 99,250,250 position object 99,0,0,210 texture object 99,26 set object light 99,0 set object transparency 99,4 lock object on 99 repeat for count=ants to 1 step -1 ant(count).x#=ant(count-1).x# ant(count).z#=ant(count-1).z# next count if yvel#<(150.0/fps) then yvel#=yvel#+(1.0/fps) tempx=ant(0).x# tempz=ant(0).z# for count=0 to ants temp2x=ant(count).x# temp2z=ant(count).z# if tempx=temp2x and tempz=temp2z ant(count).y#=ant(count).y#-yvel# endif position object 1000+count,ant(count).x#+0.5,ant(count).y#+yoffset#,ant(count).z#-0.5 next count if ant(0).y#>-50 then gosub positioncamera sync until ant(0).y#<-150 wait key if lives=1 delete object 99 make object plain 99,250,250 position object 99,0,0,210 texture object 99,27 set object light 99,0 set object transparency 99,4 lock object on 99 play sound 4 sync wait key wipeon() for count=421 to 440 if object exist(count) then hide object count next count delete music 1 for x=1 to 4 delete sound x next x for x=1000 to 1000+ants delete object x next x for x=400 to 500+objs if object exist(x) then delete object x next x for x=1 to 100 if sprite exist(x) then delete sprite x if image exist(x) then delete image x next x set display mode 800,600,32 gosub highscoretable goto menu endif wipeon() delete object 99 for count=1 to ants delete object count+1000 next count for count=501 to objs+500 delete object count next count for count=2 to 25 delete image count next count delete object 2001 delete object 2002 for count=1 to randomapples delete object count+400 next count dec lives,1 ants=0 applesalive=0 undim randomapple(0) dim randomapple(0) as randomappleinfo gosub loadlevelmedia makenewant=0 destination=1 loop object 1000 for count=4 to 17 if sprite exist(count) then delete sprite count next count printscore(score) printants(ants) printlives(lives) hide object 1000 gosub positioncamera wipeoff() seconds#=timer()-1 frames=39 show object 1000 return movepickupparticles: for count=1 to 20 if pickupparticle(count).alive pickupparticle(count).x#=pickupparticle(count).x#+(pickupparticle(count).xvel#/fps) pickupparticle(count).y#=pickupparticle(count).y#+(pickupparticle(count).yvel#/fps) pickupparticle(count).yvel#=pickupparticle(count).yvel#-(100.0/fps) position object count+420,pickupparticle(count).x#,pickupparticle(count).y#,pickupparticle(count).z# if pickupparticle(count).fade#<0 pickupparticle(count).fade#=0 pickupparticle(count).alive=0 hide object count+420 else scale object count+420,pickupparticle(count).fade#,pickupparticle(count).fade#,100 dec pickupparticle(count).fade#,0.5 point object count+420,camera position x(),camera position y(),camera position z() tempx2=pickupparticle(count).x# tempy2=pickupparticle(count).y# tempz2=pickupparticle(count).z# if tempy2>0 and tempy2<9 if level(tempx2,tempy2,tempz2).terrain=2 pickupparticle(count).alive=0 hide object count+420 endif endif endif endif next count return highscoretable: gosub loadmenumedia `load music "sound\midi\hiscore1.mid",5 `loop music 5 sprite 68,0,0,2 open to read 1,"leveldata\level10.dat" for x=1 to 10 read string 1,temp$ highscore(x).name$=temp$ read file 1,temp highscore(x).score=temp next x close file 1 if score>highscore(10).score load music "sound\midi\hiscore1.mid",5 loop music 5 mess$="congratulations you got" mess2$="a high score" mess3$="please enter your name" xpos=40 for x=1 to 23 if mid$(mess$,x)=" " inc xpos,20 else sprite x,xpos,100,asc(mid$(mess$,x)) inc xpos,sprite width(x)+5 endif next x xpos=200 for x=1 to 12 if mid$(mess2$,x)=" " inc xpos,20 else sprite x+23,xpos,150,asc(mid$(mess2$,x)) inc xpos,sprite width(x+23)+5 endif next x xpos=65 for x=1 to 22 if mid$(mess3$,x)=" " inc xpos,20 else sprite x+45,xpos,300,asc(mid$(mess3$,x)) inc xpos,sprite width(x+45)+5 endif next x name$="" sprite 1000,400,300,1 offset sprite 1000,400,300 set sprite priority 1000,10 scale=100 alph=255 repeat scale sprite 1000,scale inc scale,10 if scale>800 and alph=>0 set sprite alpha 1000,alph dec alph,10 endif sync until scale>1000 and alph<0 delete sprite 1000 curstimer=timer()+100 repeat if timer()>curstimer if sprite visible(69) hide sprite 69 else show sprite 69 endif curstimer=timer()+100 endif if scancode()=0 then keypressed=0 if keytype$(scancode())<>"" and len(name$)<15 and keypressed=0 keypressed=1 name$=name$+keytype$(scancode()) endif if scancode()=14 and keypressed=0 and len(name$)>0 keypressed=1 name$=left$(name$,len(name$)-1) endif for x=70 to 85 if sprite exist(x) then delete sprite x next x xpos=140 for x=1 to len(name$) if mid$(name$,x)=" " inc xpos,20 else sprite x+69,xpos,400,asc(mid$(name$,x)) inc xpos,sprite width(x+69)+5 endif next x curspos=xpos sprite 69,curspos,400,42 size sprite 69,25,25 sync until scancode()=28 or scancode()=156 for x=1 to 10 if score>highscore(x).score if x<10 for y=10 to x+1 step -1 highscore(y).score=highscore(y-1).score highscore(y).name$=highscore(y-1).name$ next y endif highscore(x).score=score highscore(x).name$=name$ exit endif next x delete file "leveldata\level10.dat" open to write 1,"leveldata\level10.dat" for x=1 to 10 temp$=highscore(x).name$ write string 1,temp$ temp=highscore(x).score write file 1,temp next x close file 1 sprite 1000,400,300,1 offset sprite 1000,400,300 set sprite priority 1000,10 scale=1000 repeat scale sprite 1000,scale dec scale,10 sync until scale<100 delete sprite 1000 for x=1 to 100 if sprite exist(x) then delete sprite x next x delete music 5 endif load music "sound\midi\hiscore2.mid",5 loop music 5 sprite 1,0,0,2 sprno=2 temp$="high score table" xpos=150 for x=1 to 16 if mid$(temp$,x)<>" " sprite sprno,xpos,25,asc(mid$(temp$,x)) inc xpos,sprite width(sprno)+5 inc sprno,1 else inc xpos,20 endif next x for x=1 to 10 xpos=80 for y=1 to len(highscore(x).name$) if mid$(highscore(x).name$,y)<>" " sprite sprno,xpos,x*40+50,asc(mid$(highscore(x).name$,y)) inc xpos,sprite width(sprno)+2 inc sprno,1 else inc xpos,20 endif next y xpos=500 for y=1 to len(str$(highscore(x).score)) sprite sprno,xpos,x*40+50,asc(mid$(str$(highscore(x).score),y)) inc xpos,sprite width(sprno)+2 inc sprno,1 next y next x sprite 1000,400,300,1 offset sprite 1000,400,300 set sprite priority 1000,10 scale=100 alph=255 repeat scale sprite 1000,scale inc scale,10 if scale>800 and alph=>0 set sprite alpha 1000,alph dec alph,1 endif sync until scale>1000 and alph<0 delete sprite 1000 sync wait key for x=1 to sprno if sprite exist(x) then delete sprite x next x sprite 1000,400,300,1 offset sprite 1000,400,300 set sprite priority 1000,10 scale=1000 repeat scale sprite 1000,scale dec scale,10 sync until scale<100 delete sprite 1000 delete music 5 return function wipeon() make object plain 101,250,250 texture object 101,42 set object texture 101,2,0 set object transparency 101,4 set object light 101,0 position object 101,-70,0,200 lock object on 101 make object plain 102,250,250 zrotate object 102,180 texture object 102,42 set object texture 102,2,0 set object transparency 102,4 set object light 102,0 position object 102,70,0,200 lock object on 102 y=250 for x=-250 to -70 step 3 position object 101,x,0,200 position object 102,y,0,200 dec y,3 sync next x endfunction function wipeoff() y=70 for x=-70 to -250 step -3 position object 101,x,0,200 position object 102,y,0,200 inc y,3 sync next x delete object 101 delete object 102 endfunction function pausegame(tempsecs#,music,ants) vol=50 pgchoice=1 for x=0 to ants stop object x+1000 next x make object plain 99,120,120 position object 99,0,0,210 texture object 99,33 set object light 99,0 set object transparency 99,1 lock object on 99 make object plain 98,100,100 position object 98,0,0,210 texture object 98,35 set object light 98,0 set object transparency 98,1 lock object on 98 make object plain 97,100,100 position object 97,0,-30,210 texture object 97,36 set object light 97,0 set object transparency 97,1 lock object on 97 repeat if music=1 and vol=>0 set music volume 1,vol dec vol,1 endif if upkey() and pgchoice=2 pgchoice=1 endif if downkey() and pgchoice=1 pgchoice=2 endif if pgchoice=2 scale object 98,50,50,100 scale object 97,100,100,100 else scale object 98,100,100,100 scale object 97,50,50,100 endif sync until keystate(28) or keystate(156) quit=0 if pgchoice=2 quit=1 wipeon() endif if music=1 then set music volume 1,50 for x=0 to ants loop object x+1000 next x for pgcount=97 to 99 delete object pgcount next pgcount tempsecs#=timer()+tempsecs# endfunction tempsecs# function makepickupparticles(x#,y#,z#) play sound 3 `xvel#=0.01 `yvel#=0.05 xstart#=-0.5 for count=1 to 10 pickupparticle(particleindex).x#=x# pickupparticle(particleindex).y#=y# pickupparticle(particleindex).z#=z# pickupparticle(particleindex).xvel#=(0.0+(xstart#/50))*200 temp#=rnd(140) temp#=temp#/10 temp#=temp#+17.0 pickupparticle(particleindex).yvel#=temp# pickupparticle(particleindex).alive=1 show object particleindex+420 temp=rnd(30)+70 scale object particleindex+420,temp,temp,100 pickupparticle(particleindex).fade#=temp inc particleindex if particleindex>20 then particleindex=1 xstart#=xstart#+0.25 next count endfunction function printscore(score) width=0 tenmil=score/10000000 score=score-(tenmil*10000000) mil=score/1000000 score=score-(mil*1000000) hundthou=score/100000 score=score-(hundthou*100000) tenthou=score/10000 score=score-(tenthou*10000) thou=score/1000 score=score-(thou*1000) hund=score/100 score=score-(hund*100) ten=score/10 score=score-(ten*10) units=score places=1 if ten then places=2 if hund then places=3 if thou then places=4 if tenthou then places=5 if hundthou then places=6 if mil then places=7 if tenmil then places=8 dim scores(8) scores(8)=tenmil scores(7)=mil scores(6)=hundthou scores(5)=tenthou scores(4)=thou scores(3)=hund scores(2)=ten scores(1)=units for count=places to 1 step -1 sprite count+3,0,0,scores(count)+5 width=width+sprite width(count+3)+5 next count xpos=(screen width()-width)/2 for count=places to 1 step -1 sprite count+3,xpos,50,scores(count)+5 xpos=xpos+5+sprite width(count+3) next count endfunction function printants(ants) width=0 inc ants,1 hund=ants/100 ants=ants-(hund*100) ten=ants/10 ants=ants-(ten*10) units=ants places=1 if ten then places=2 if hund then places=3 dim antz(3) antz(3)=hund antz(2)=ten antz(1)=units for count=places to 1 step -1 sprite count+11,0,0,antz(count)+5 width=width+sprite width(count+11)+5 next count xpos=55-(width/2) for count=places to 1 step -1 sprite count+11,xpos,50,antz(count)+5 xpos=xpos+5+sprite width(count+11) next count endfunction function printlives(lives) width=0 hund=lives/100 lives=lives-(hund*100) ten=lives/10 lives=lives-(ten*10) units=lives places=1 if ten then places=2 if hund then places=3 dim life(3) life(3)=hund life(2)=ten life(1)=units for count=places to 1 step -1 sprite count+14,0,0,life(count)+5 width=width+sprite width(count+14)+5 next count xpos=(screen width()-60)-(width/2) for count=places to 1 step -1 sprite count+14,xpos,50,life(count)+5 xpos=xpos+5+sprite width(count+14) next count endfunction